package com.clusterswisdom.horn.api.tmall.action.bill;

import com.alibaba.fastjson.JSONObject;
import com.clusterswisdom.horn.api.ioc.HornAction;
import com.clusterswisdom.horn.api.ioc.HornResponse;
import com.clusterswisdom.horn.api.ioc.api.ApiConfig;
import com.clusterswisdom.horn.api.tmall.TmallInstance;
import com.clusterswisdom.horn.api.tmall.action.AbstractTmallAction;
import com.taobao.api.response.BillAccountsGetResponse;

public class GetBillAccountsAction extends AbstractTmallAction implements HornAction {

	@Override
	public HornResponse execute(ApiConfig config, JSONObject param) throws Exception {
		BillAccountsGetResponse response = (BillAccountsGetResponse) TmallInstance.getInstance().executeRequest(param, "bill", "billAccountsGet");
		if(response.isSuccess()) {
			return new HornResponse(true,response.getAccounts());
			
		} else {
			return getUnsuccessResponse(response);
			
		}	
	}
}